import pygame
import sys
from init_map import InitMap


class Map(InitMap):
    def __init__(self, *args):
        InitMap.__init__(self)

        self.shadow_soldier = pygame.image.load("../资源/图片/影子战士.png").convert_alpha()
        self.dark_leader = pygame.image.load("../资源/图片/冥队长.png").convert_alpha()
        self.ling_warrior = pygame.image.load("../资源/图片/灵武士.png").convert_alpha()

        self.hero_pos = (5, 8)
        self.up_pos = (0, 10)
        self.down_pos = (5, 7)
        self.variable_pos = {
            (4, 8): (self.shadow_soldier, '影子战士'),
            (2, 10): (self.shadow_soldier, '影子战士'),
            (2, 8): (self.dark_leader, '冥队长_ss'),
            (2, 0): (self.dark_leader, '冥队长_ss'),
            (1, 7): (self.dark_leader, '冥队长_ss'),
            (1, 1): (self.dark_leader, '冥队长_ss'),
            (1, 8): (self.ling_warrior, '灵武士_ss'),
            (1, 0): (self.ling_warrior, '灵武士_ss'),
            (10, 0): (self.ling_warrior, '灵武士_ss'),
            (10, 2): (self.ling_warrior, '灵武士_ss'),
            (3, 2): (self.ling_warrior, '灵武士_ss'),
            (3, 5): (self.ling_warrior, '灵武士_ss'),
            (5, 4): (self.ling_warrior, '灵武士_ss'),
            (9, 4): (self.ling_warrior, '灵武士_ss'),
            (9, 6): (self.ling_warrior, '灵武士_ss'),
            (7, 6): (self.ling_warrior, '灵武士_ss'),
            (7, 8): (self.ling_warrior, '灵武士_ss'),
            (10, 8): (self.ling_warrior, '灵武士_ss'),
            (10, 10): (self.ling_warrior, '灵武士_ss'),
        }

    def fixed_brick(self):
        self.draw(self.upstairs, self.up_pos[0], self.up_pos[1])
        self.dic[self.up_pos] = '上楼'
        self.draw(self.downstairs, self.down_pos[0], self.down_pos[1])
        self.dic[self.down_pos] = '下楼'
        for i in range(9):
            for j in [1, 3, 7]:
                if (i, j) != (8, 1) and (i, j) != (1, 3) and (i, j) != (3, 7) and (i, j) != (5, 7):
                    self.draw(self.wall, i+2, j)
                    self.dic[(i+2, j)] = '墙'
            self.draw(self.wall, i, 9)
            self.dic[(i, 9)] = '墙'
        for j in range(10):
            self.draw(self.wall, 0, j)
            self.dic[(0, j)] = '墙'
        for i in [(2, 2), (2, 4), (4, 4), (2, 5), (2, 6), (3, 6), (4, 6), (5, 6), (6, 6), (6, 5), (7, 5), (8, 5), (10, 4),
                  (10, 5), (10, 6), (6, 8), (9, 9)]:
            self.draw(self.wall, i[0], i[1])
            self.dic[(i[0], i[1])] = '墙'

        for i in self.ls:
            self.screen.blit(self.road, i)
            self.dic[(int((i[0]-375)/48), int((i[1]-25)/48))] = '路'
